import service from '@/utils/Request'
export function getAllArticles(condition,page) {
    return service({
      url: `/articles/byCondition?condition=${condition}&page=${page}`,
      method: 'get',
    })
  }
  
    // export function getAllArticles(page){
    //   return service({
    //     url:'/articles',
    //     method:'get',
    //   })
    // }
    
    export function getRecommendedArticles(page){
      return service({
        url:`/articles/byHobbies?page=${page}`,
        method:'get',
      })
    }
    export function getFollowingArticles(page){
      return service({
        url:`/articles/byFocus?page=${page}`,
        method:'get',
      })
    }
    

  export function getOneArticle(id) {
    return service({
      url: `/articles/${id}`,
      method: 'get',
    })
  }
  export function getMyArticles(id,page) {
    return service({
      url: `/articles/byUserId/${id}?page=${page}`,
      method: 'get',
    })
  }

  export function getNotices() {
    return service({
      url: `/notices`,
      method: 'get',
    })
  }
  export function getOneNotice(id) {
    return service({
      url: `/notices/${id}`,
      method: 'get',
    })
  }

  export function agree(id) {
    return service({
      url: `/articles/support/${id}`,
      method: 'put',
    })
  }

  export function getComments(id) {
    return service({
      url: `/comments/article/${id}`,
      method: 'get',
    })
  }

  export function putComments(data) {
    return service({
      url: `/comments`,
      method: 'post',
      data
    })
  }

  export function getTags() {
    return service({
      url: `/tags`,
      method: 'get'
    })
  }


  export function getTagsForList(id,page) {
    return service({
      url: `/articles/byTag/${id}?page=${page}`,
      method: 'get'
    })
  }


  export function getPhb() {
    return service({
      url: `/articles/sortBySupport`,
      method: 'get'
    })
  }

